import type { FieldRule } from 'vant'

const mobileRules: FieldRule[] = [
  { required: true, message: '请输入手机号' },
  { pattern: /^1[3-9]\d{9}$/, message: '手机号格式不正确' },
]
const passwordRules: FieldRule[] = [
  { required: true, message: '请输入密码' },
  { pattern: /^\w{8,24}$/, message: '密码格式不正确' },
]
const codeRules: FieldRule[] = [
  { required: true, message: '请输入验证码' },
  { pattern: /^\d{6}$/, message: '验证码格式不正确' },
]
const nameRules: FieldRule[] = [
  { required: true, message: '请输入姓名' },
  { pattern: /^[\u4e00-\u9fa5]{2,4}$/, message: '姓名格式不正确' },
]
const idCardRules: FieldRule[] = [
  { required: true, message: '请输入身份证号' },
  {
    pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
    message: '身份证号格式不正确',
  },
]
export { mobileRules, passwordRules, codeRules, nameRules, idCardRules }
